package peration;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindBook implements IOperation{
    @Override
    public void dowork(BookList bookList) {
        System.out.println("输入你要查找的图书：");
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        int size = bookList.getUsedSize();
        for(int i= 0; i<size; i++){
            Book book = bookList.getBook(i);
            if(book.getName().equals(name)){
                System.out.println(book);
                return;
            }
        }
        System.out.println("未找到" + name + "这本书");


    }
}
